<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
	String path = request.getContextPath() + "/";
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<head>
<base href="<%=basePath%>">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<title>朗读亭——刷卡记录管理</title>
<!-- Tell the browser to be responsive to screen width -->
<meta
	content="width=device-width, initial-scale=1, maximum-scale=1, read-scalable=no"
	name="viewport">
</head>
<body>
	<section class="content-header">
      <h1>
        系统管理
        <small>刷卡记录管理</small>
      </h1>
    </section>

    <!-- Main content -->
    <section class="content">
      <div id="myTabContent" class="tab-content">
		<!-- 查询面板 -->
		<div class="tab-pane active" id="search">
			<section class="content-header">
			<div class="row">
				<form id="typeForm">
				<input name="pageNo" id="pageNo" type="hidden"/>
				<input name="pageSize" id="pageSize" type="hidden" value="6"/>
				<div class="col-sm-2">
				<input type="text" class="form-control input-lg" id="cardno"
						name="cardno" placeholder="读者证号"></div>
				</form>
				<div class="col-sm-2">
					<button class="btn btn-primary input-lg"
						onclick="searchList(1);">查询刷卡记录</button>
				</div>
			</div>
			</section>
		</div>
	</div>
      <div class="row" style="margin-top:10px;">
        <div class="col-xs-12">

          <div class="box">
            <!-- /.box-header -->
            <div class="box-body">
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>卡号</th>
                  <th>姓名</th>
                  <th>所属机构</th>
                  <th>刷卡设备</th>
                  <th>刷卡时间</th>
                </tr>
                </thead>
						<tbody id="list">
						</tbody>
					</table>
				<div class="paging" id="pageInfo"></div>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
<script src="js/jquery-1.9.1.js"></script>
<script src="js/bootstrap.js"></script>
<script src="dist/js/app.min.js"></script>
<script src="js/page1.js"></script>
<script type="text/javascript" src="js/layer/layer.js"></script>
<script>
$(document).ready(function() {
	searchList(1);
});
function searchList(pageNo){
	$("#pageNo").val(pageNo);
		$.ajax({
			async : false,
			cache : false,
			type : 'post',
			dataType : "json",
			data : $("#typeForm").serialize(),
			url : 'read/scard_list_data' ,// 请求的action路径
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				layer.msg("请求失败！");
			},
			success : function(data) {
				if(data.state=="9003"){
					layer.msg("没有权限！");
					return ;
				}else if(data.state=="9002"){
					layer.msg("请重新登录！");
					top.location.reload();
					return ;
				}
					var list = data.list;
					var strHtml = "";
					for(var i=0;i<list.length;i++){
						strHtml +='<tr><td>'+list[i].cardno+'</td>'+
							'<td>'+list[i].name+'</td>'+
							'<td>'+list[i].gname+'</td>'+
							'<td>'+list[i].dname+'</td>'+
							'<td>'+list[i].sdate+'</td></tr>';
					}
					if(list.length==0){
						strHtml = "<tr style=\"text-align:center;\"><td colspan=\"5\">找不到刷卡记录信息！</td></tr>";
					}
					$("#list").html(strHtml);
					$("#pageInfo").html(pageInfo(data.totalPage,data.pageNumber));
					$("#totalRows").html(data.totalRow);
			}
		});	
}
</script>
</body>
</html>